import request from "@/axios"
export function listCart() {
    let url = "/api/cart/list"
    return request.get(url)
}

//加入购物车
export function addCart(goodsId,skuName,quantity) {
    if(!quantity)quantity=1
    let url = '/api/cart/add'
    let data = {
        goodsId,skuName,quantity
    }
    return request.post(url,data)
}

//改变购物车
export function changeCart(cartId,amount,selected) {

    let url = '/api/cart/change'
    let data = {
        cartId,amount,selected
    }
    return request.post(url,data)
}

//删除购物车
export function deleteCart(id) {
    let url ='/api/cart/delete'
    let data = {
        id
    }
    return request.post(url,data)
}

//全选
export function changeAll(selected) {
    let url = '/api/cart/all/selected'
    let data = {
        selected
    }
    return request.post(url,data)
}

//计算物流费
export function getLogFee(province) {
    let url = '/api/cart/logFee'
    let params = {province}
    return request.get(url,{params})
}